# Path check script for Dinghong Cloud Screen project
# This script verifies the correct path calculation

$ErrorActionPreference = "Stop"

Write-Host "Checking paths for Dinghong Cloud Screen project..." -ForegroundColor Green

# Current script location
$SCRIPT_PATH = $MyInvocation.MyCommand.Path
Write-Host "Script location: $SCRIPT_PATH" -ForegroundColor Cyan

# Calculate project root with different methods
$METHOD1 = Split-Path -Parent (Split-Path -Parent $SCRIPT_PATH)
$METHOD2 = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $SCRIPT_PATH))
$METHOD3 = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $SCRIPT_PATH)))

Write-Host "`nPath calculation methods:" -ForegroundColor Yellow
Write-Host "Method 1 (2 levels up): $METHOD1" -ForegroundColor White
Write-Host "Method 2 (3 levels up): $METHOD2" -ForegroundColor White
Write-Host "Method 3 (4 levels up): $METHOD3" -ForegroundColor White

# Check which method gives us the correct project root
Write-Host "`nChecking for server directory:" -ForegroundColor Yellow
$serverPath1 = Join-Path $METHOD1 "server"
$serverPath2 = Join-Path $METHOD2 "server"
$serverPath3 = Join-Path $METHOD3 "server"

if (Test-Path $serverPath1) {
    Write-Host "✓ Server found at: $serverPath1" -ForegroundColor Green
}
else {
    Write-Host "✗ Server not found at: $serverPath1" -ForegroundColor Red
}

if (Test-Path $serverPath2) {
    Write-Host "✓ Server found at: $serverPath2" -ForegroundColor Green
}
else {
    Write-Host "✗ Server not found at: $serverPath2" -ForegroundColor Red
}

if (Test-Path $serverPath3) {
    Write-Host "✓ Server found at: $serverPath3" -ForegroundColor Green
}
else {
    Write-Host "✗ Server not found at: $serverPath3" -ForegroundColor Red
}

Write-Host "`nChecking for web directory:" -ForegroundColor Yellow
$webPath1 = Join-Path $METHOD1 "web"
$webPath2 = Join-Path $METHOD2 "web"
$webPath3 = Join-Path $METHOD3 "web"

if (Test-Path $webPath1) {
    Write-Host "✓ Web found at: $webPath1" -ForegroundColor Green
}
else {
    Write-Host "✗ Web not found at: $webPath1" -ForegroundColor Red
}

if (Test-Path $webPath2) {
    Write-Host "✓ Web found at: $webPath2" -ForegroundColor Green
}
else {
    Write-Host "✗ Web not found at: $webPath2" -ForegroundColor Red
}

if (Test-Path $webPath3) {
    Write-Host "✓ Web found at: $webPath3" -ForegroundColor Green
}
else {
    Write-Host "✗ Web not found at: $webPath3" -ForegroundColor Red
}

Write-Host "`nPath check completed!" -ForegroundColor Green 